package jmine.tec.persist.result.domain;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import bancosys.tec.persist.bussobj.PersistableBusinessObject;

@Entity
@Table(uniqueConstraints = @UniqueConstraint(columnNames = "chave"))
public class Result extends PersistableBusinessObject {

    private static final long serialVersionUID = 4075331785709007008L;

    private Long id;

    private int chave;

    private Double value;

    /**
     * @return the id
     */
    @Id
    @GeneratedValue
    public Long getId() {
        return this.id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * @return the chave
     */
    public int getChave() {
        return this.chave;
    }

    /**
     * @return the value
     */
    public Double getValue() {
        return this.value;
    }

    /**
     * @param chave the chave to set
     */
    public void setChave(int chave) {
        this.chave = chave;
    }

    /**
     * @param value the value to set
     */
    public void setValue(Double value) {
        this.value = value;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = super.hashCode();
        result = prime * result + this.chave;
        return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (this.getClass() != obj.getClass()) {
            return false;
        }
        Result other = (Result) obj;
        if (this.chave != other.chave) {
            return false;
        }
        return true;
    }

}
